﻿using INTEX.DataBase.Tools;
using ReflectionStudio.Core.Events;
using System;
using System.Data;
using System.Windows;
using System.Windows.Data;
using System.Data.OracleClient;
using ReflectionStudio.Components.UserControls;
using System.ComponentModel;
namespace WPFExcelReport
{
    public partial class TAB02:UIABKOPF
    {
        public TAB02()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return; 
            InitializeComponent();
        }
        public override void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                if (DesignerProperties.GetIsInDesignMode(this))
                    return;
                if (IsLoaded)
                    return;
                base.Window_Loaded(sender, e);
            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
            }
        }
        public override void vwMaster_CurrentChanged(object sender, EventArgs e)
        {
            base.vwMaster_CurrentChanged(sender, e);
            dwABK = dwMaster;
            if (dwABK != null)
            {
                KRS = dwABK["ABKAUFKRS"].ToString();
                LFD = dwABK["ABKAUFLFD"].ToString();
            }
            else
            {
                KRS = "";
                LFD = "";
            }
        }
        public override void LOADBYAUF()
        {
            TBMain.Clear();
            if (ORDERNUM.Length < 8)
                return;
            dwData = TBMain.NewRow();
            dwData["ABKMANDANT"] = app.Mandant;
            dwData["ABKAUFKRS"] = ORDERNUM.Substring(0, 2);
            dwData["ABKAUFLFD"] = ORDERNUM.Substring(2, 6);
            SResult = ((VABKOPF)MV).QueryABKOPF(dwData, 7);
            MergeData(SResult, true, true);
        }
    }
}

